package com.soxing.webrain.brush.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.soxing.webrain.brush.service.webSocket.WebSocketServer;
import com.soxing.webrain.brush.domain.view.R;

@RestController
@RequestMapping("/neuroCut")
public class NeuroCutController {

    private final WebSocketServer webSocketServer;

    @Autowired
    public NeuroCutController(WebSocketServer webSocketServer) {
        this.webSocketServer = webSocketServer;
    }

    @RequestMapping("/checkConnection")
    public R checkConnection() {
        if(webSocketServer.hasType("data")) {
            WebSocketServer.sendDateFlag("为了伯伦希尔的荣耀");

            return R.ok().message("已连接");
        } else {
            return R.ok().message("未连接");
        }
    }

}
